package model{
	import flash.display.DisplayObject;
	import flash.display.Sprite;
	import flash.events.*;
	import flash.text.TextField;
	
	import model.GlobalTextFormat;
	
	public class ActionButton extends Sprite
	{
		
		//[Embed('assets/component.swf', symbol='NavigationButtonMovieClip')]
		//private static var NavigationButtonMovieClip:Class;
		
		private var actionButton:ActionButtonMovieClip;
		private var label:TextField;
		
		public function ActionButton()
		{
			actionButton = new ActionButtonMovieClip();
			label = new TextField();
			addChild(actionButton);
			actionButton.x = 0;
		}
		
		public function set text(value:String):void
		{
			if(!contains(label))
			{
				label.autoSize = "center";
				label.selectable = false;
				label.multiline = true; 
				addChild(label);
			}
			
			label.text = value;
			label.x = 13;
			label.y = 6;
			//label.width = actionButton.width;
			label.height = actionButton.height;
			label.setTextFormat(GlobalTextFormat.actionButtonStyle);
			actionButton.width = label.textWidth + 20;
		}
		
		override public function set width(value:Number):void
		{
			actionButton.width = value;
			label.width = value;
		}
		
		override public function get width():Number
		{
			return actionButton.width;
		}
		
		override public function set height(value:Number):void
		{
			actionButton.height = value;
		}
		
		override public function get height():Number
		{
			return actionButton.height;
		}
	}
}